import { listLibrary} from "@/api/paper/library";
export const volume= {
  data() {
    return {
      // 遮罩层
      vloading: true,
      // 选中数组
      vid: '',
      vname: '',
      // 显示搜索条件
      vshowSearch: true,
      // 总条数
      vtotal: 0,
      // 卷库表格数据
      vlibraryList: [

      ],
      // 查询参数
      vqueryParams: {
        pageNum: 1,
        pageSize: 10,
        classesId: null,
        name: null,
        code: null,
        other: null,
        state: null
      },
      // 选择卷库弹出框
      volumeVisible: false,
      // 考试设置界面需要的参数
      index: null,
    };
  },
  created() {
    this.vgetList();
  },
  methods: {
      // 弹出卷库选择框
      volume(index){
        console.log('卷库选择');
      this.volumeVisible = true;
      this.index = index;
      },
    /** 查询卷库列表 */
    vgetList() {
      this.vloading = true;
      listLibrary(this.vqueryParams).then(response => {
        this.vlibraryList = response.rows;
        this.vtotal = response.total;
        this.vloading = false;
      });
    },
    /** 搜索按钮操作 */
    vhandleQuery() {
      this.vqueryParams.pageNum = 1;
      this.vgetList();
    },
    /** 重置按钮操作 */
    vresetQuery() {
      // this.vresetForm("queryForm");
      this.vhandleQuery();
    },
     // 关闭内部对话框    用户点击确定
    closeVolumeDialogT() {
      if (this.index >= 0) {
        this.addForm.sessionList[this.index].volumeLibraryId = this.vid;
        this.addForm.sessionList[this.index].volumeLibraryName = this.vname;

      }else {
        this.form.volumeLibraryName = this.vname;
        this.form.volumeLibraryId = this.vid;
        this.selform.volumeLibraryName = this.vname;
        this.selform.volumeLibraryId = this.vid;
        this.queryParams.volumeLibraryName = this.vname;
        this.queryParams.volumeLibraryId = this.vid;
      }
      this.volumeVisible=false;
    },

    // 关闭内部对话框，   用户点击取消
    closeVolumeDialogF(){
      this.volumeVisible=false;
      this.vid = null;
      this.vname = null;
    },
    vrowclick(e){
      console.log(e);
      this.vid = e.id;
      this.vname = e.name;
    },
  }
};
